<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core">

<f:view>
	<h:head>
	
		<script type="text/javascript"
			src="${facesContext.externalContext.requestContextPath}/views/scripts/jquery.js"></script>

		<style type="text/css" title="currentStyle">
			@import "${facesContext.externalContext.requestContextPath}/views/css/home1.css";
			@import "${facesContext.externalContext.requestContextPath}/views/css/app.css";
			@import "${facesContext.externalContext.requestContextPath}/views/css/reset.css";
			@import "${facesContext.externalContext.requestContextPath}/views/css/text.css";
		</style>
		
		<script type="text/javascript">
			$(document).ready(function() {
				var alt = $("#user_img").attr("alt");
				if( alt == null || alt.length == 0)
				{
					
					var src = $("#user_img").attr("src") + "no_photo.png";
			    	icon_alt = "no_photo.png";
			    	//alert(src);
			    	$("#user_img").attr("src", src);
			    	$("#user_img").attr("alt", icon_alt);
				}
			});
		</script>
	</h:head>
	<h:body id="players" class="team">
		<ui:include src="../header.xhtml" />
		<br />
		<br />
		<br />
		<h:form>
		<!--  -->
		<div id="main" class="container_12">
		<ui:include src="team_header.xhtml" />
		
		<div class="grid_12">
		<div class="grid_8 alpha">
			<div id="content">
				<h1 id="h1">#{teamService.getTeam(userProfileBean.teamId).name}</h1>
				<span id="smallbadge_container"></span>
				<div class="clear"></div>
				
				
				<div id="email_verification_explanation" style="display:none;">
				<span class="email_verify_first_name"></span>'s Teamer account has an email address, but the email on file was not included when <span class="email_verify_first_name"></span> was added to your team. <br/><br/>When <span class="email_verify_first_name"></span> verifies this team membership the email address will become visible. In the meantime <span class="email_verify_first_name"></span> will still receive email notifications.
				</div>
				<div id="phone_verification_explanation" style="display:none;">
				<span class="phone_verify_first_name"></span>'s Teamer account has a phone number, but the number on file was not included when <span class="phone_verify_first_name"></span> was added to your team. <br/><br/>When <span class="phone_verify_first_name"></span> verifies this team membership the phone number will become visible. In the meantime <span class="phone_verify_first_name"></span> will still receive phone notifications.
				</div>
				
				
				
				<div style="float:left;width:200px;">
					<a href="../images/member_icons/#{memberService.getMember(userProfileBean.memberEmail).photo}" 
						onclick="return hs.expand(this, null, { photo_path : '../images/member_icons/#{memberService.getMember(userProfileBean.memberEmail).photo}' });" 
						title="Click Photo to Enlarge">
						<img id="user_img" alt="#{memberService.getMember(userProfileBean.memberEmail).photo}" class="shadow" 
						src="../images/member_icons/#{memberService.getMember(userProfileBean.memberEmail).photo}" />
					</a>
					<br/>
					<br/>
						<p>
							<a href="#" class="button pill" 
							onclick="Modalbox.show($('upload'), {title: 'upload profile photo', width: 600, slideDownDuration: 0, slideUpDuration: 0, resizeDuration: 0}); return false;" 
							title="Upload or delete profile photo">
							Change Photo</a>
						</p>
				</div>
				
				<div style="float:left;margin-left: 20px;width:380px;">
				<div style="display: none;">
					<h:inputText value="#{userProfileBean.memberEmail}"></h:inputText>
				</div>
				
				<table id="profile-info" class="gradient-style">
					<thead>
						<tr>
							<th colspan="2">
								#{memberService.getMember(userProfileBean.memberEmail).firstname}
								#{memberService.getMember(userProfileBean.memberEmail).lastname}
								
								<h:commandLink class="button pill icon edit" style="float:right;" 
											   value="Edit Member Profile" 
											   action="#{userProfileBean.gotoEditMemberProfilePage}" >
									<f:setPropertyActionListener target="#{editMemberProfileBean.memberEmail}" value="#{userProfileBean.memberEmail}" />	
									<f:setPropertyActionListener target="#{editMemberProfileBean.firstName}" value="#{memberService.getMember(userProfileBean.memberEmail).firstname}" />	
									<f:setPropertyActionListener target="#{editMemberProfileBean.lastName}" value="#{memberService.getMember(userProfileBean.memberEmail).lastname}" />			   
									<f:setPropertyActionListener target="#{editMemberProfileBean.gender}" value="#{memberService.getMember(userProfileBean.memberEmail).gender}" />			   
								</h:commandLink>
							</th>				
						</tr>
					</thead>
				  <tbody>
						<tr>
						  <td class="field_name">Email Address</td>
							<td class="field_value">
			  				<span class="show-to-admin show-to-organiser">#{memberService.getMember(userProfileBean.memberEmail).email}</span>
			          		<span class="show-to-player" style="display:none">#{memberService.getMember(userProfileBean.memberEmail).email}</span>
							</td>
						</tr>
						
				 			<tr>
								<td class="field_name">Description</td>
								<td class="field_value">
			    			  		<span class="show-to-admin show-to-organiser">#{memberService.getMember(userProfileBean.memberEmail).description}</span>
			            			<span class="show-to-player" style="display:none">#{memberService.getMember(userProfileBean.memberEmail).description}</span>
								</td>
				 			</tr>
				 			
				 		
						<tr>
						  <td class="field_name">Added to This Team</td> <td class="field_value">#{memberService.getMember(userProfileBean.memberEmail).description}</td>
						</tr>
						<tr>
						  <td class="field_name">Team Role</td> <td class="field_value">#{memberService.getMember(userProfileBean.memberEmail).description}</td>
						</tr>			
						<tr>
						  <td class="field_name">Gender</td> <td class="field_value">#{memberService.getMember(userProfileBean.memberEmail).gender}</td>
						</tr>
						
						<tr>
						  <td class="field_name">Other Teams</td> <td class="field_value">	<a href="/users/4844123-fan-jin/teams" class="btn">View Teams</a></td>
						</tr>
						
			  			<tr>
			  				<td class="field_name">User Profile</td>
			  				<td class="field_value"><a href="/users/4844123-fan-jin" class="btn">View User Profile</a></td>
			  			</tr>
						
				  </tbody>
				</table>
				
			</div>
			
			<div class="clear"></div>
				
				
				
			</div>
		</div>
		</div>
		</div>
		
		</h:form>
		<ui:include src="../footer.xhtml" />

	</h:body>
</f:view>
</html>